'use strict'


module.exports = app => {
    const mongoose = app.mongoose
    const Schema = mongoose.Schema
    const ObjectId = Schema.Types.ObjectId
    const NoticeSchema = new Schema({
        user_id:{
            type:ObjectId,
            ref:'User'
        },
        type:{
            type:String,
            enum:['动态','消息','赞同','关注']
        },
        text:{
            type:String
        },
        question_id:{
            type:ObjectId,
            ref:'Question'
        },
        reply_id:{
            type:ObjectId,
            ref:'Reply'
        },
        comment_id:{
            type:ObjectId,
            ref:'Comment'
        },
        res_user_id:{
            type:ObjectId,
            ref:'User'
        },
        res_comment_id:{
            type:ObjectId,
            ref:'Comment'
        },
        res_reply_id:{
            type:ObjectId,
            ref:'Reply'
        },
        see:{
            type:Boolean,
            default:false
        },
        create_time:{
            type:Date,
            default:Date.now
        }
    },{ versionKey:false })

    return mongoose.model('Notice',NoticeSchema,'Notice')
}
